home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / POV-Ray 3.0.2 / src / MacSource / SplashScreen.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-14  |  3.4 KB  |  121 lines  |  [TEXT/CWIE]

  1. /*==============================================================================
  2. Project:    POV
  3.  
  4. Version:    3
  5.  
  6. File:    SplashScreen.c
  7.  
  8. Description:
  9. Routines to handle the display of the initial splash screen.
  10. ------------------------------------------------------------------------------
  11. Author:
  12.     Eduard [esp] Schwan
  13. ------------------------------------------------------------------------------
  14.     from Persistence of Vision(tm) Ray Tracer
  15.     Copyright 1996 Persistence of Vision Team
  16. ------------------------------------------------------------------------------
  17.     NOTICE: This source code file is provided so that users may experiment
  18.     with enhancements to POV-Ray and to port the software to platforms other 
  19.     than those supported by the POV-Ray Team.  There are strict rules under
  20.     which you are permitted to use this file.  The rules are in the file
  21.     named POVLEGAL.DOC which should be distributed with this file. If 
  22.     POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  23.     Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  24.     Forum.  The latest version of POV-Ray may be found there as well.
  25.  
  26.     This program is based on the popular DKB raytracer version 2.12.
  27.     DKBTrace was originally written by David K. Buck.
  28.     DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  29. ------------------------------------------------------------------------------
  30. Change History:
  31. ==============================================================================*/
  32.  
  33. #define SPLASHSCREEN_C
  34.  
  35. #include "SplashScreen.h"
  36. #include "ScreenUtils.h"
  37.  
  38. #include <types.h>
  39. #include <windows.h>
  40. #include <resources.h>
  41. #include <string.h>
  42. #include <strings.h>
  43.  
  44. #include "POVMac.h"        // gDist_Message
  45. #include "OptOut.h"        // POV_RAY_VERSION
  46.  
  47.  
  48. #define DLOG_SPLASH        138
  49.  
  50.  
  51. static DialogPtr        gSplashScreen = NULL;
  52. static long                gSplashStartTicks = 0;
  53.  
  54.  
  55. // ---------------------------------------------------------------------
  56. Boolean SplashScreenShown(void)
  57. {
  58.     return gSplashScreen != NULL;
  59. } // SplashScreenShown
  60.  
  61.  
  62. // ---------------------------------------------------------------------
  63. void UpdateSplashScreen(void)
  64. {
  65.     if    ((gSplashStartTicks + 6*60L) < MAC_TICKS)    // timeout after several seconds
  66.             KillSplashScreen();
  67. } // UpdateSplashScreen
  68.  
  69.  
  70.  
  71. // ---------------------------------------------------------------------
  72. void SelectSplashScreen(void)
  73. {
  74.     if (gSplashScreen)
  75.         {
  76.         SelectWindow(gSplashScreen);
  77.         DrawDialog(gSplashScreen);
  78.         }
  79. } // SelectSplashScreen
  80.  
  81.  
  82.  
  83. // ---------------------------------------------------------------------
  84. // Get and display the intro splash screen
  85. void CreateSplashScreen(void)
  86. {
  87.     char    povVers[16];
  88.     gSplashStartTicks = 0;
  89.     gSplashScreen = GetNewDialog(DLOG_SPLASH, NULL, (WindowPtr) -1);
  90.     if (gSplashScreen != NULL)
  91.     {
  92.         gSplashStartTicks = MAC_TICKS;
  93.         strcpy(povVers, POV_RAY_VERSION);
  94.         c2pstr(povVers);
  95.  
  96.         ParamText((StringPtr)povVers, gDistMessage, "\p", "\p");
  97.         SetPort((GrafPtr)gSplashScreen);
  98.  
  99.         TextFont(geneva);
  100.         TextSize(9);
  101.  
  102.         PositionWindow(gSplashScreen, ewcDoCentering, eSameAsPassedWindow, (WindowPtr)gp2wWindow);
  103.         ShowWindow(gSplashScreen);
  104.         SelectWindow(gSplashScreen);
  105.         DrawDialog(gSplashScreen);
  106.     }
  107. } // CreateSplashScreen
  108.  
  109.  
  110.  
  111. // ---------------------------------------------------------------------
  112. // close and dispose of the intro splash screen
  113. void KillSplashScreen(void)
  114. {
  115.     if (gSplashScreen)
  116.         DisposeDialog(gSplashScreen);
  117.     gSplashScreen = NULL;
  118.     gSplashStartTicks = 0;
  119.  
  120. } // KillSplashScreen
  121.